<?xml version='1.0' encoding='UTF-8'?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:a="http://java.sun.com/jsf/composite/custom"
	template="../templates/template.xhtml">
		
	<ui:define name="section-titre" />
	
	<ui:define name="content">
		
		<div class="contenu-item">
			<h2>#{msg.dclRechercheDirecteTitle}</h2>
			<p>#{msg.dclRechercheDirectePresentation}</p>
			
			<h:outputText value="#{msg.dclRechercheNo}" styleClass="txtGras" />
			<br />

			<p:autoComplete value="#{requestSearchPage.reference}" completeMethod="#{requestSearchPage.completeRequestReference}"
					minQueryLength="3"/>
			<br />
			
			<h:commandButton value="#{msg.dclRechercheDirecteSubmitBut}" action="#{requestSearchPage.directSearch}"
								styleClass="button" />
		</div>
		
		<div class="contenu-item">
			<h2>#{msg.dclRechercheTitle}</h2>
			<p>#{msg.dclRecherchePresentation}</p>
			
			<fieldset>
				<h:panelGrid columns="2" columnClasses="txtGras, ">
					<h:outputText value="#{msg.dclRechercheTypeDC}" />
					<h:selectOneRadio value="#{requestSearchPage.type}">
						<f:selectItems value="#{requestSearchPage.types}" var="type" itemLabel="#{type}" itemValue="#{type}" />
					</h:selectOneRadio>
					
					<h:outputText value="#{msg.dclRechercheObjet}" />
					<h:inputText value="#{requestSearchPage.title}" />
					
					<h:outputText value="#{msg.dclRechercheProjet}" />
					<h:selectManyListbox value="#{requestSearchPage.projects}" size="4" converter="projectConverter">
						<f:selectItem itemLabel=" - " itemValue="null" />
						<f:selectItems value="#{app.allProjects}" var="proj" itemLabel="#{proj.name}" itemValue="#{proj}" />
					</h:selectManyListbox>
					
					<h:outputText value="#{msg.dclRechercheDateCrea}" />
					&#160;
					

					<h:outputText value="#{msg.dclRechercheDateDu}" styleClass="right"/>
					<p:calendar value="#{requestSearchPage.dateFrom}" pattern="#{app.dateFormat}" startWeekday="1"/>
						
					<h:outputText value="#{msg.dclRechercheDateAu}" styleClass="right"/>
					<p:calendar value="#{requestSearchPage.dateTo}" pattern="#{app.dateFormat}" startWeekday="1"/>
										
				</h:panelGrid>
				<h:commandButton action="#{requestSearchPage.search}" value="#{msg.dclRechercheSubmitBut}" styleClass="button"/>
			</fieldset>
		</div>

	    <h:panelGroup rendered="#{not empty requestSearchPage.results}">
			<h2>#{msg.dclRechercheResTitle}</h2>
			<a:reqList tableId="data" value="#{requestSearchPage.results}" listSize="15" />
	    </h:panelGroup>
		
	</ui:define>
	
</ui:composition>